dojo.provide("uws.drawing.usecase.Actor");
dojo.require('uws.drawing.Component');

dojo.declare('uws.drawing.usecase.Actor',uws.drawing.Component,{
	constructor: function(surface,id,dx,dy, sortOrder,label,fromDS){
		this.center_x = 19;
        this.center_y = 35;
		this.sortOrder = sortOrder;
		
		if(fromDS){
			dx+=this.center_x;
			dy+=this.center_y;
		}
		
		//connector top
		this.top_con=this.connectors_shape_group.createCircle({
			cx:19,
			cy:5,
			r:3
		}).setStroke("white").setFill("white");
		
		//connector bottom
		this.bottom_con=this.connectors_shape_group.createCircle({
			cx:19,
			cy:75,
			r:3
		}).setStroke("white").setFill("white");
		
		//connector left
		this.left_con=this.connectors_shape_group.createCircle({
			cx:4,
			cy:35,
			r:3
		}).setStroke("white").setFill("white");
		
		//connector right
		this.right_con=this.connectors_shape_group.createCircle({
			cx:34,
			cy:35,
			r:3
		}).setStroke("white").setFill("white");
		
		//for mouse only. invinsible
		this.actual_shape_group.createRect({
			x:4,
			y:5,
			width:30,
			height:70
		}).setFill("white").setStroke("white");
		
		//head
		this.actual_shape_group.createEllipse({
			rx:9,
			ry:10,
			cx:19,
			cy:15
		}).setStroke("black").setFill("white");
		
		//body
		this.actual_shape_group.createLine({
			x1:19,
			y1:26,
			x2:19,
			y2:48
		}).setStroke({color:"black"});
		
		//left leg
		this.actual_shape_group.createLine({
			x1:19,
			y1:48,
			x2:5,
			y2:59
		}).setStroke({color:"black"});
		
		//right leg
		this.actual_shape_group.createLine({
			x1:19,
			y1:48,
			x2:34,
			y2:61
		}).setStroke({color:"black"});
		
		//hands
		this.actual_shape_group.createLine({
			x1:5,
			y1:35,
			x2:33,
			y2:35
		}).setStroke({color:"black"});
		
		this.label_shape = this.group.createText({
			text: label,
			x:this.center_x,
			y:(this.center_y+30+8),
			align:"middle"
		}).setFill("black").setFont(defaultFont);
		
		this._postCreate(dx, dy);
	},
	setLabel:function(label){
		this.label_shape.setShape({
			text: label,
			x:this.center_x,
			y:(this.center_y+30+8),
			align:"middle"
		}).setFill("black").setFont(defaultFont);
	},
	applyProperties:function(properties){
		this.label_shape.setShape({
			text: properties.label,
			x:this.center_x,
			y:(this.center_y+30+8),
			align:"middle"
		}).setFill("black").setFont(defaultFont);
	}
});